/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cc.altius.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author sagar
 */
@Entity
@Table(name = "zone")
@NamedQueries({
    @NamedQuery(name = "Zone.findAll", query = "SELECT z FROM Zone z"),
    @NamedQuery(name = "Zone.findByZoneId", query = "SELECT z FROM Zone z WHERE z.zoneId = :zoneId"),
    @NamedQuery(name = "Zone.findByZoneCode", query = "SELECT z FROM Zone z WHERE z.zoneCode = :zoneCode"),
    @NamedQuery(name = "Zone.findByZoneName", query = "SELECT z FROM Zone z WHERE z.zoneName = :zoneName"),
    @NamedQuery(name = "Zone.findByZonePriority", query = "SELECT z FROM Zone z WHERE z.zonePriority = :zonePriority")})
public class Zone implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ZONE_ID")
    private Integer zoneId;
    @Column(name = "ZONE_CODE")
    private String zoneCode;
    @Column(name = "ZONE_NAME")
    private String zoneName;
    @Column(name = "ZONE_PRIORITY")
    private Integer zonePriority;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "zoneId")
//    private List<Hospital> hospitalList;
    @JoinColumn(name = "MASTER_ZONE_ID", referencedColumnName = "MASTER_ZONE_ID")
    @ManyToOne
    private MasterZone masterZoneId;

    public Zone() {
    }

    public Zone(Integer zoneId) {
        this.zoneId = zoneId;
    }

    public Integer getZoneId() {
        return zoneId;
    }

    public void setZoneId(Integer zoneId) {
        this.zoneId = zoneId;
    }

    public String getZoneCode() {
        return zoneCode;
    }

    public void setZoneCode(String zoneCode) {
        this.zoneCode = zoneCode;
    }

    public String getZoneName() {
        return zoneName;
    }

    public void setZoneName(String zoneName) {
        this.zoneName = zoneName;
    }

    public Integer getZonePriority() {
        return zonePriority;
    }

    public void setZonePriority(Integer zonePriority) {
        this.zonePriority = zonePriority;
    }

//    public List<Hospital> getHospitalList() {
//        return hospitalList;
//    }
//
//    public void setHospitalList(List<Hospital> hospitalList) {
//        this.hospitalList = hospitalList;
//    }

    public MasterZone getMasterZoneId() {
        return masterZoneId;
    }

    public void setMasterZoneId(MasterZone masterZoneId) {
        this.masterZoneId = masterZoneId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (zoneId != null ? zoneId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Zone)) {
            return false;
        }
        Zone other = (Zone) object;
        if ((this.zoneId == null && other.zoneId != null) || (this.zoneId != null && !this.zoneId.equals(other.zoneId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cc.altius.model.Zone[ zoneId=" + zoneId + " ]";
    }
    
}
